package com.bbs.serviceimpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bbs.mapper.forumMapper;
import com.bbs.po.forum;
import com.bbs.service.forumService;

@Service
public class forumServiceImpl implements forumService {

	@Autowired
	private forumMapper forummapper;
	@Override
	public List<forum> getAllForum() {
		List<forum> list = new ArrayList<>();
		list = forummapper.selectAll();
		return list;
	}
	@Override
	public int setForum(String forumname, String manager, int id) {
		int t = forummapper.setForum(forumname, manager, id);
		if(t == 0){
			int n = forummapper.setForum(forumname, manager, id);
			if(n == 0)
				return 0;
		}
		return 1;
	}
	@Override
	public int deleteForum(Integer id) {
		int t = forummapper.deleteForum( id);
		if(t == 0){
			int n = forummapper.deleteForum(id);
			if(n == 0)
				return 0;
		}
		return 1;
	}
	@Override
	public int createForum(String forumname, String manager) {
		int t = forummapper.createForum(forumname,manager);
		if(t == 0){
			int n = forummapper.createForum(forumname,manager);
			if(n == 0)
				return 0;
		}
		return 1;
	}

}
